import treeUtil from '../src/utils/tree.js';

const tree = [
    { menuId: 1, name: 'Node 1', children: [{ menuId: 2, name: 'Node 1.1', parentId: 1, children: [{ menuId: 4, name: 'Node 1.1.1', parentId: 2 },] },
            { menuId: 3, name: 'Node 1.2', parentId: 1 },] },
    { menuId: 5, name: 'Node 2', parentId: null, children: [{ menuId: 6, name: 'Node 2.1', parentId: 5 },] },
    { menuId: 7, name: 'Node 3.1', parentId: 8 },
];

const treeArray = treeUtil.convertToArray(tree);
console.log(treeArray);